import request from "@/utils/request";
import {ShopForm, ShopQuery} from "./types";

const baseUri = "/mv1/api/shop";

/**
 * 获取用户分页列表
 *
 * @param query
 */
export function getShopList(query: ShopQuery) {
  return request({
    url: baseUri + "/",
    method: "get",
    params: query,
  });
}

/**
 * 获取用户表单详情
 *
 * @param userId
 */
export function getShopForm(userId: number) {
  return request({
    url: baseUri + "/detail/" + userId,
    method: "get",
  });
}

/**
 * 修改
 *
 * @param id
 * @param data
 */
export function updateShop(id: number, data: ShopForm) {
  return request({
    url: baseUri + "/edit/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 修改新增
 *
 * @param id
 * @param data
 */
export function createShop(data: ShopForm) {
  return request({
    url: baseUri + "/edit",
    method: "post",
    data: data,
  });
}

/**
 * 删除用户
 *
 * @param ids
 */
export function deleteShop(id: number) {
  return request({
    url: baseUri + "/" + id,
    method: "delete",
  });
}
